
import java.io.Serializable;
import java.util.ArrayList;

public class User implements Serializable{
    private static int id_counter = 1;
    private int id;
    private String username;
    private double coins;
    private ArrayList<Idea> owned_ideas = new ArrayList<>();

    public void User(){
        this.id = id_counter;
        id_counter++;
        this.username = "Username";
        this.coins = 5000;
    }

    public void User(String user, double c){
        this.id = id_counter;
        id_counter++;
        this.username = user;
        this.coins = c;
    }

    public int getId(){
        return this.id;
    }

    public String getUsername(){
        return this.username;
    }

    public double getCoins(){
        return this.coins;
    }

    public ArrayList<Idea> getOwnedIdeas(){
        return this.owned_ideas;
    }

    public void setUsername(String new_user){
        this.username = new_user;
    }

    public void setCoins(double c){
        this.coins = c;
    }

    public void updateCoins(double diff){
        this.coins += diff;
    }

    public void addOwnedIdea(Idea i){
        this.owned_ideas.add(i);
    }

    public void deleteOwnedIdea(Idea i){
        this.owned_ideas.remove(i);
    }

    public void showOwnedIdeas(){
        int max = this.owned_ideas.size();
        for(int i=0; i<max; i++){
            this.owned_ideas.get(i).toString();
        }
    }

    @Override
    public String toString(){
        String i = String.valueOf(this.id);
        return "ID= " + i + ", Username= " + this.username;
    }
}
